package com.mh.study.springcloud.controller;

import com.mh.study.springcloud.service.ResumeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author MH
 * @since 2022-02-20
 */
@Slf4j
@RestController
@RequestMapping("/resume")
public class ResumeController {

    @Value("${server.port}")
    private Integer port;

    @Autowired
    private ResumeService resumeService;

    @GetMapping("/open-state/{userId}")
    public Integer findDefaultResumeState(@PathVariable Long userId) {
        return resumeService.findDefaultResumeByUserId(userId).getIsOpenResume();
    }

    @GetMapping("/get-port")
    public Integer getPort() {
        return this.port;
    }

    @GetMapping("/get-port-2")
    public Integer getPort2() {
        log.info("这里测试sleuth+zipkin");
        return this.port;
    }
}
